<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml"
      xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>400客户设备列表</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link rel="stylesheet" href="/dist/plugins/select2/select2.min.css">
    <!--插件样式-->
    <link href="/dist/plugins/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet"/>
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=39cd89cd">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style>
        .table > tbody > tr > td {
            line-height: 24px;
            max-height: 24px;
            overflow: hidden;
        }

        span.lineOne {
            line-height: 28px;
            height: 28px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .divCheck {
            height: 100%;
            margin-left: 5px;
            line-height: 25px;
        }

        .divCheck input {
            float: left;
            margin-top: 7px;
            margin-right: 5px;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .left {
            width: 170px;
            float: left;
        }

        .right {
            margin-left: 180px;
        }

        .templateStyle {
            border: 1px solid #ddd;
            padding: 0 10px;
        }

        .lineOne {
            text-align: left;
        }

        .lineOne span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }

        .lineOneNoMore {
            text-align: left;
        }

        .lineOneNoMore span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }
        .table{
            border:1px solid #cbcbcd;
        }

        .jiaobiao3 {
            position: relative;
        }

        .jiaobiao3 i {
            display: block;
            width: 6px;
            height: 6px;
            background: url("/dist/img/newLog3.png");
            position: absolute;
            top: 0px;
            right: 5px;
        }
    </style>
</head>
<body>
<section class="content" id="app">
    <div class="div-td-content-more"><i></i></div>
    <iframe id="ifExprot" style="width:0px;height:0px;display: none;" frameborder="0"></iframe>
    <div class="box-body no-padding iframeH3" id="scrollDiv">
        <table class="table table-hover  text-center table-striped">
            <thead>
            <tr>
                <th style="width: 20px"><div class="table-cells"></div></th>
                <th style="width: 30px"><div class="table-cells">序号</div></th>
                <th style="width: 50px"><div class="table-cells">品牌</div></th>
                <th style="width: 45px"><div class="table-cells">类型</div></th>
                <th style="width: 45px"><div class="table-cells">型号</div></th>
                <th style="width: 120px"><div class="table-cells">序列号</div></th>
                <th style="width: 75px"><div class="table-cells">交车日期</div></th>
                <th style="width: 55px"><div class="table-cells">付款方式</div></th>
            </tr>
            </thead>
            <tbody>
            <tr v-for="(item,i) in list">
                <td>
                    <input type="checkbox" @click="checked(i)"
                           :checked="i===selectId" @click.prevent = "" enabled="isEnable(item)" />
                </td>
                <td style="width: 37px;text-align: center;"><div class="table-cell">{{i+1}}</div></td>
                <td style="width: 61px;text-align: center;"><div class="table-cell">{{item.brandName}}</div></td>
                <td style="width: 61px;text-align: center;"><div class="table-cell">{{item.deviceType}}</div></td>
                <td style="width: 70px;text-align: center;"><div class="table-cell">{{item.modelName}}</div></td>
                <td class="td-tanZongStyle-line" style="width: 80px;text-align: center;">
                    <div class="table-cell">{{item.serialNo}}</div>
                </td>
                <td style="width: 75px;text-align: center;"><div class="table-cell">{{item.deliveryDate}}</div></td>
                <td style="width: 61px;text-align: center;"><div class="table-cell">{{item.buyType}}</div></td>
            </tr>
            </tbody>
        </table>
        <div class="south no-print" style="height:50px;line-height:50px;text-align:center;">
                <input type="button" value="确定" class="btn oaBtn btn-sm" @click="confirm">
        </div>
    </div>
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=558d0414"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<!--ztree组件所需js-->
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.exhide-3.5.js"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script type="text/javascript">
    $.wyui.page.getByPage_callback = function (data) {
        app.nowPage = ($.wyui.page.queryParams.requestPage - 1) * 30
        app.list = data;
        if (app.isCheckedAll) {
            for (var j = 0; j < app.list.length; j++) {
                app.selectIds.push(app.list[j].id)
            }
        }
    };
    $.wyui.page.getByPage_scroll_callback = function (list) {
        if (list.length < 30) {
            isLoad = false;
        } else {
            for (var i = 0; i < list.length; i++) {
                app.list.push(list[i]);
            }
            isLoad = true;
        };
    };
    var api = frameElement.api, W = api.opener;
    function refresh() {
        $.wyui.page.getByPage();
    }
    var app = new Vue({
        el: '#app',
        data: {
            currentUser: getCurrentUser(),
            pageType: $.wyui.page.urlParams.pageType,
            list: [],
            deviceInfo:{
                main:{}
            },
            nowPage: 0,
            selectId: '',
            isCheckedAll: false,
            isCheckNew: false
        },
        methods: {
            isArray: function (id) {
                var that = this;
                if ($.inArray(id, that.selectIds) > -1) {
                    // 如果已经包含了该id, 则去除(单选按钮由选中变为非选中状态)
                    return true;
                } else {
                    // 选中该checkbox
                    return false;
                }
            },
            isEnable: function (item) {
                return true;
            },
            checked: function (i) {
                var that = this;
                console.log(i,that.selectId)
                if (i===that.selectId) {
                    // 如果已经包含了该id, 则去除(单选按钮由选中变为非选中状态)
                    that.selectId = '';
                } else {
                    // 选中该checkbox
                    that.selectId = i;
                }
            },
            confirm:function () {
                var that = this;
                if(that.selectId !== ''){
                    var num = that.selectId;
                    console.log(num);
                    parent.app.other = that.list[num];
                    var api = frameElement.api, W = api.opener;
                    api.close();
                }
//                alert(that.selectId)
//                $.wyui.postMethod(urlConfig.contract.selectContractById, {id: that.selectId}, function (data) {
//                    that.deviceInfo = data;
//                    parent.app.other=data;
//                    api.close;
//
//                })
            },
            getCustomerDeviceList:function () {
                var that = this;
                $.wyui.postMethod(urlConfig.call.getCustomerDeviceList,
                    {tel:$.wyui.page.urlParams.tel},
                    function (data) {
                        that.list = data;
                        console.log(that.list)
                    });
            }
        },
        mounted: function () {
            var that = this;
            that.getCustomerDeviceList();
            console.log(JSON.stringify(currentUser))
        }
    });
</script>
<script>
    /************************滚动加载******************************/
    var divscroll = document.getElementById('scrollDiv');

    function divScroll() {
        var wholeHeight = divscroll.scrollHeight;
        var scrollTop = divscroll.scrollTop;
        var divHeight = divscroll.clientHeight;
        console.log(scrollTop + divHeight, wholeHeight)
        if (scrollTop + divHeight >= wholeHeight - 2) {
//            alert('滚动到底部了！');
            if (isLoad) {
                isLoad = false;
                setTimeout($.wyui.page.getByPage("scroll"), 1000);

            }

            //这里写动态加载的逻辑，比如Ajax请求后端返回下一个页面的内容
        }

    }

    divscroll.onscroll = divScroll;
</script>
</body>
</html>